﻿<Window x:Class="VendorProducts.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="600" Width="1000" Loaded="Window_Loaded" Closing="Window_Closing" xmlns:my="clr-namespace:VendorProducts">
	<Window.Resources>
		<my:NorthwindDataSet x:Key="northwindDataSet" />
		<CollectionViewSource x:Key="productsViewSource" Source="{Binding Path=Products, Source={StaticResource northwindDataSet}}" />
	</Window.Resources>
	<Grid DataContext="{StaticResource productsViewSource}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>
		<Menu>
			<MenuItem Header="Save" Name="mnuSave" Click="mnuSave_Click" />
			<MenuItem Header="Exit" Name="mnuExit" Click="mnuExit_Click" />
	</Menu>
		<DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" Height="540" HorizontalAlignment="Left" ItemsSource="{Binding}" Name="productsDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" Width="978" Grid.Row="1" CanUserDeleteRows="False">
			<DataGrid.Columns>
				<DataGridTextColumn x:Name="productIDColumn" Binding="{Binding Path=ProductID}" Header="Product ID" IsReadOnly="True" Width="SizeToHeader" Visibility="Hidden" />
				<DataGridTextColumn x:Name="productNameColumn" Binding="{Binding Path=ProductName}" Header="Product Name" Width="*" />
				<DataGridTextColumn x:Name="supplierIDColumn" Binding="{Binding Path=SupplierID}" Header="Supplier ID" Width="SizeToHeader" />
				<DataGridTextColumn x:Name="categoryIDColumn" Binding="{Binding Path=CategoryID}" Header="Category ID" Width="SizeToHeader" />
				<DataGridTextColumn x:Name="quantityPerUnitColumn" Binding="{Binding Path=QuantityPerUnit}" Header="Quantity Per Unit" Width="SizeToHeader" />
				<DataGridTextColumn x:Name="unitPriceColumn" Binding="{Binding Path=UnitPrice}" Header="Unit Price" Width="SizeToHeader" />
				<DataGridTextColumn x:Name="unitsInStockColumn" Binding="{Binding Path=UnitsInStock}" Header="Units In Stock" Width="SizeToHeader" />
				<DataGridTextColumn x:Name="unitsOnOrderColumn" Binding="{Binding Path=UnitsOnOrder}" Header="Units On Order" Width="SizeToHeader" />
				<DataGridTextColumn x:Name="reorderLevelColumn" Binding="{Binding Path=ReorderLevel}" Header="Reorder Level" Width="SizeToHeader" />
				<DataGridCheckBoxColumn x:Name="discontinuedColumn" Binding="{Binding Path=Discontinued}" Header="Discontinued" Width="SizeToHeader" />
			</DataGrid.Columns>
		</DataGrid>
	</Grid>	
</Window>
